package org.example.demo21.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.example.demo21.entity.bo.DemoBO;
import org.example.demo21.service.DesignModeService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 *
 * @author guocong
 * @since 2024/3/29 13:42
 */
@RestController
@Tag(name = "设计模式演示demo")
@RequestMapping("/design")
public class DesignModeController {


    @Resource
    private DesignModeService designModeService;


    @Operation(summary = "模板", description = "模板", method = "GET")
    @GetMapping(value = "/temp")
    public void temp() {
        designModeService.temp();
    }

    @Operation(summary = "责任链", description = "责任链", method = "POST")
    @PostMapping(value = "/chain")
    public void chain(@RequestBody DemoBO demoBO) {
        designModeService.chain(demoBO);
    }


    @Operation(summary = "策略", description = "策略", method = "POST")
    @PostMapping(value = "/strategy")
    public DemoBO strategy(@RequestBody DemoBO demoBO) {
        return designModeService.strategy(demoBO);
    }

    @Operation(summary = "装饰", description = "装饰", method = "POST")
    @PostMapping(value = "/decorator")
    public void decorator() {
        designModeService.decorator();
    }


    @Operation(summary = "迭代器", description = "迭代器", method = "POST")
    @PostMapping(value = "/iter")
    public void tier() {
        designModeService.iter();
    }


}
